<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


  <title>My JSP 'courseAll.jsp' starting page</title>

  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="cache-control" content="no-cache">
  <meta http-equiv="expires" content="0">
  <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  <meta http-equiv="description" content="This is my page">
  <!--
  <link rel="stylesheet" type="text/css" href="styles.css">
  -->
  <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
  <style type="text/css">
    .div_list {
      width: 75%;
      margin: 0 auto;
      margin-top: 50px;
      margin-left: 20%;

    }
    #tableClass{
      margin:0 auto;
      width: 100%

    }
    .form1{
      width: 200px;
      display: inline-block
    }
    font {
      color: red;
      font-weight: bold;
      text-align: center;
    }
    table{
      margin:0 auto;

    }
    table tr td{
      text-align: center;
      width:150px;
      height:40px;
    }
    a{
      text-decoration: none;
      cursor:pointer;
    }
  </style>
  <script src="${pageContext.request.contextPath}/js/jquery-1.11.1.min.js"></script>

  <script type="text/JavaScript">
    //分页
    function getPage(page){
      //1.把page设置到查询表单的隐藏域
      $("#page").val(page);
      //2.获取表单对象提交
      $("#myForm").submit();
    }
  </script>
</head>

<body>
<h4 align="center">
  <form action="${pageContext.request.contextPath}/ServletFindAllUser" method="post" id="myForm">
    姓名：<input type="text" name="uname"
              placeholder="请输入查询条件" value="${user.uname}">
    <!--编写一个当前页的隐藏域  -->
    <input type="hidden" name="page" id="page" value="1"> <input
          type="submit" value="查询">
  </form>
</h4>
<div class="div_list panel panel-default">
  <div class="panel-heading">用户信息</div>
  <table class="table panel-body" id="tableClass">
    <tr>
      <td>编号</td>
      <td>账号</td>
      <td>姓名</td>
      <td>密码</td>
      <td>手机号</td>
      <td>性别</td>
      <td>年龄</td>
      <td>余额</td>
      <td>邮箱</td>
    
    </tr>
    <c:forEach var="list" items="${pageUtil.list}">
      <tr>
        <td>${list.getUser().getUid() }</td>
       <td>${list.getUser().getUnum()}</td>
        <td>${list.getUser().getUname()}</td>
        <td>${list.getUser().getUpwd()}</td>
        <td>${list.getPhone() }</td>
        <td>${list.getSex()==1?"男":"女"}</td>
        <td>${list.getAge() }</td>
        <td>${list.getMoney() }</td>
        <td>${list.getEmail()}</td>
       

      </tr>
    </c:forEach>
    <tr>
      <td colspan="9">总记录数：${pageUtil.totalCount}
        当前页/总页数：${pageUtil.currentPage}/${pageUtil.totalPages} &nbsp;&nbsp;&nbsp;
        <a href="#" onclick="getPage(1)">首页</a>
        <a href="#" onclick="getPage(${pageUtil.prevPage })">上一页</a>
        <a href="#" onclick="getPage(${pageUtil.nextPage })">下一页</a>
        <a href="#" onclick="getPage(${pageUtil.totalPages })">尾页</a>
      </td>
    </tr>

  </table>
</div>
</body>
</html>
